﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJ.Data.Inventory;
using PJ.Framework.Common;

namespace PJ.Business.Inventory
{
    /// <summary>
    /// InventoryItemOrderParam class
    /// </summary>
    /// <typeparam name="OD">Inner data object</typeparam>
    public abstract class InventoryItemOrderParam<OD> : EntityExtension<OD>, IInventoryItemOrderParam
        where OD : IInventoryItemOrderParamData
    {
        public InventoryItemOrderParam()//IInventoryItemService ownerService)
 //           : base(ownerService)
        {
        }
        public InventoryItemOrderParam(OD data)
            : base(data)//, InjectionBroker.Resolve<IInventoryItemService>())
        {
        }
        //public InventoryItemOrderParam()
        //    : base(InjectionBroker.Resolve<IInventoryItemService>())
        //{
        //}

        public override void CopyFrom(IBusinessObject data)
        {
            base.CopyFrom(data);
            IInventoryItemOrderParam idata = data as IInventoryItemOrderParam;
            if (idata == null)
                throw new ArgumentException();
            this.UnitId = idata.UnitId;
            this.DefaultQuantity = idata.DefaultQuantity;
            this.MultipleQuantity = idata.MultipleQuantity;
            this.MinQuantity = idata.MinQuantity;
            this.MaxQuantity = idata.MaxQuantity;
        }


        public string UnitId
        {
            get
            {

                return ObjectData.UnitId;
            }
            set
            {
                ObjectData.UnitId = value;
            }
        }


        public double DefaultQuantity
        {
            get
            {
                return ObjectData.DefaultQuantity;
            }
            set
            {
                ObjectData.DefaultQuantity = value;
            }
        }

        public double MultipleQuantity
        {
            get
            {
                return ObjectData.MultipleQuantity;
            }
            set
            {
                ObjectData.MultipleQuantity = value;
            }
        }

        public double MinQuantity
        {
            get
            {
                return ObjectData.MinQuantity;
            }
            set
            {
                ObjectData.MinQuantity = value;
            }
        }

        public double MaxQuantity
        {
            get
            {
                return ObjectData.MaxQuantity;
            }
            set
            {
                ObjectData.MaxQuantity = value;
            }
        }


    }
}
